<template lang="jade">


	div.return-bar
		i.iconfont(@click="back()") &#xe668;
		邀请好友
	div.friend-main.detail_top
		ul.invite
			li
				好友姓名: 
				input(v-model="f_name")
			li
				手机号码: 
				input(v-model="f_phone")
			li
				button.obtn.m_btn(@click=" add() ") 发送邀请
</template>

<script>
import '../../assets/sass/user/index.scss'
import {Api_Friend_Invite} from '../../config/api'



export default{
	data(){
		return{
			f_name:"",
			f_phone:""
		}
	},
	methods: {
		add(){

			var that = this;
			if(that.f_phone=='' && that.f_name==''){
				alert("姓名或手机不能为空!");
				return false;
			}

			var data = {'phone':that.f_phone, 'realname':that.f_name}
			this.$http.post(Api_Friend_Invite, data,'').then(function (rs) {
				var rs = rs.data;
				alert(rs.msg);
				if(rs.status)
					that.$route.router.go('/user');
			});
		},
		
	    back(){
	      window.history.back();
	    }

	},
	route:{
		activate( transition ){
            /* if(sessionStorage.getItem("login")==null){
              this.$route.router.go('/login?from='+this.$route.path.substring(1))
              return false;
            } */
			transition.next();
		}
	}
}

</script>
